package com.spzx.product.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.spzx.common.core.utils.PageUtils;
import com.spzx.common.core.utils.StringUtils;
import com.spzx.product.api.domain.Brand;
import com.spzx.product.service.BrandService;
import com.spzx.product.mapper.BrandMapper;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author sun
* @description 针对表【brand(分类品牌)】的数据库操作Service实现
* @createDate 2024-07-14 15:19:40
*/
@Service
public class BrandServiceImpl extends ServiceImpl<BrandMapper, Brand>
    implements BrandService{

    @Resource
    private BrandMapper brandMapper;

    @Override
    public List<Brand> listBrand(Brand brand) {
        PageUtils.startPage();
        return brandMapper.selectList(
                new LambdaQueryWrapper<Brand>()
                        .like(StringUtils.hasText(brand.getName()), Brand::getName, brand.getName())
        );
    }

    @Override
    public List<Brand> selectBrandAll() {
        return brandMapper.selectList(new LambdaQueryWrapper<Brand>().select(Brand::getId,Brand::getName,Brand::getLogo));
    }
}




